package com.jader.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyData extends SQLiteOpenHelper {

	private static final int version = 1;

	// 数据库名
	private static String db_NAME = "mydata.db";
	// 表名
	public static String TABLENAME = "search";
	public static String LUNBOYUPIC_TABLENAME = "lunbo";
	public static String GOODSLIST_TABLE = "goodslist";
	public static String GOODSLIST_MERCHANT_TABLE = "merchantgoodslist";
	public static String tiezibiao = "tiezibiao";
	@SuppressWarnings("unused")
	private SQLiteDatabase db = null;

	public MyData(Context context) {
		super(context, db_NAME, null, version);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		String sql1 = "create table " + TABLENAME
				+ "(name varchar(20) not null)";
		String sql2 = "create table " + LUNBOYUPIC_TABLENAME
				+ "(goodsid int(20) not null,"
				+ " picture varchar(200) not null)";
		String sql3 = "create table " + GOODSLIST_TABLE
				+ " (goodsid int(20) not null,"
				+ "  description varchar(200),"
				+ " price double(20) not null , "
				+ " picture varchar(200) not null"
				+ ", goodsname varchar(20) not null) ";
		String sql4 = "create table " + GOODSLIST_MERCHANT_TABLE
				+ " (goodsid int(20) not null,"
				+ "  description varchar(200),"
				+ " price double(20) not null , "
				+ " picture varchar(200) not null"
				+ ", goodsname varchar(20) not null) ";
		String sql5="create table "+tiezibiao
				+" (tiezi_id bigint(30) not null,"
				+ "date varchar(50),"
				+ "tupian1 varchar(100),"
				+ "tupian2 varchar(100),"
				+ "tupian3 varchar(100),"
				+ "theme varchar(100),"
				+ "praciteNumber int(10),"
				+ "hearphoto varchar(100),"
				+ "username varchar(10))";
		db.execSQL(sql1);
		db.execSQL(sql2);
		db.execSQL(sql3);
		db.execSQL(sql4);
		db.execSQL(sql5);
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

}
